package com.itheima.service.impl;

import com.itheima.domain.Office;
import com.itheima.domain.Patient;
import com.itheima.mapper.PatientListMapper;
import com.itheima.service.PatientList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientListImpl implements PatientList {

    @Autowired
    private PatientListMapper patientListMapper;

    //保存挂号信息
    @Override
    public void save(Patient patient) {
        patientListMapper.save(patient);
    }


    //查询病人集合方法
    @Override
    public List<Patient> findAll(Patient patient1) {
        List<Patient> all = patientListMapper.findAll(patient1);
        //根据性别int值 封装性别信息
        for (Patient patient : all) {
            if (patient.getGender() == 1) {
                patient.setGendercata("男");
            } else {
                patient.setGendercata("女");
            }
        }
        return all;
    }
}
